GtkAboutDialog: Be slightly more flexible when listing credits
authorMatthias Clasen <mclasen@redhat.com>
Wed, 22 Dec 2010 06:03:58 +0000 (01:03 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 22 Dec 2010 06:03:58 +0000 (01:03 -0500)
Make sure we render credits ok that are occurring in the wild,
such as "Contact us at:", "<foo@bar>" or "guy1\nguy2\nguy3"

https://bugzilla.gnome.org/show_bug.cgi?id=637763
https://bugzilla.gnome.org/show_bug.cgi?id=637736

gtk/gtkaboutdialog.c

index 9edf0b647e9a929b3c2396d61971d7c5e7152227..6be3edc3e293bb3416a340e97bf39dc0a78be667 100644 (file)
@@ -2277,6 +2277,7 @@ add_credits_section (GtkAboutDialog *about,
             {
               gchar *link;
               gchar *text;
+              gchar *name;
 
               if (*q1 == '<')
                 {
@@ -2284,6 +2285,7 @@ add_credits_section (GtkAboutDialog *about,
                   gchar *escaped;
 
                   text = g_strstrip (g_strndup (q0, q1 - q0));
+                  name = g_markup_escape_text (text, -1);
                   q1++;
                   link = g_strndup (q1, q2 - q1);
                   q2++;
@@ -2291,22 +2293,25 @@ add_credits_section (GtkAboutDialog *about,
                   g_string_append_printf (str,
                                           "<a href=\"mailto:%s\">%s</a>",
                                           escaped,
-                                          text);
+                                          name[0] ? name : link);
                   g_free (escaped);
                   g_free (link);
                   g_free (text);
+                  g_free (name);
                 }
               else
                 {
                   /* uri */
                   text = g_strstrip (g_strndup (q0, q1 - q0));
+                  name = g_markup_escape_text (text, -1);
                   link = g_strndup (q1, q2 - q1);
                   g_string_append_printf (str,
                                           "<a href=\"%s\">%s</a>",
                                           link,
-                                          text);
+                                          name[0] ? name : link);
                   g_free (link);
                   g_free (text);
+                  g_free (name);
                 }
 
               q0 = q2;